package com.example.zhaojianxu.signin.car.leasecar

import android.content.Intent
import android.support.v7.widget.RecyclerView
import android.view.View
import com.example.zhaojianxu.signin.car.detail.CarDetailActivity
import com.example.zhaojianxu.signin.car.http.CarEntity
import kotlinx.android.synthetic.main.item_lease_car_view.view.*

/**
 * create by @zhaojianxu on 2019/3/1
 */
class LeaseCarVH(val rootView: View): RecyclerView.ViewHolder(rootView){

    fun bindData(data: CarEntity){

        rootView.item_car_lease_1.text = data.name
        rootView.item_car_lease_2.text = data.price.toString()
        rootView.item_car_lease_3.text = data.number.toString()

        rootView.setOnClickListener {
            val intent = Intent(rootView.context,CarDetailActivity::class.java)
            intent.putExtra("data",data)
            rootView.context.startActivity(intent)
        }
    }
}